package com.yzcs.tvapp.simple.activity

import android.content.Context
import android.util.ArrayMap
import androidx.lifecycle.MutableLiveData
import com.cxy.common.request.ApiAddress
import com.cxy.common.request.HttpUtils
import com.fy.baselibrary.application.mvvm.BaseViewModel
import com.fy.baselibrary.retrofit.observer.IProgressDialog
import com.fy.baselibrary.retrofit.observer.RequestBaseObserver


/**
 * description 豆瓣 推荐 视频 viewModel
 * Created by fangs on 2021/9/16 11:37.
 */
class RecommendVideoViewModel : BaseViewModel() {

    /**
     * 获取豆瓣推荐 影视列表
     */
    fun getRecommendVideoData(context: Context, dialog: IProgressDialog) : MutableLiveData<List<VideoBean>> {
        val liveData: MutableLiveData<List<VideoBean>> = MutableLiveData()

        val params = ArrayMap<String, Any>()
        HttpUtils.httpGetList(context, VideoBean::class.java, ApiAddress.getRecommendVideo, params)
        .subscribe(object : RequestBaseObserver<List<VideoBean>>(dialog){
            override fun onSuccess(data: List<VideoBean>) {
//                liveData.postValue(data)
            }
        })

        return liveData
    }


}